<template>
	<view class="marquee-container">
		<view class="content" :style="{ animationDuration: duration + 's' }">
			{{ text }}
		</view>
	</view>
</template>

<script>
	export default {
		name: "Marquee",
		props: {
			text: {
				type: String,
				required: true
			},
			duration: {
				type: Number,
				required: true
			},
		},
		data() {
			return {};
		}
	}
</script>

<style>
	.marquee-container {
		position: absolute;
		width: 100%;
		overflow: hidden;
		white-space: nowrap;
		box-sizing: border-box;

		line-height: 32px;
		text-align: center;
		/* background-color: beige; */
		color: #BD3124;
		font-size: 14px;
		/* font-style: italic; */
	}

	.content {
		display: inline-block;
		padding-left: 100%;
		animation: marquee linear infinite;
	}

	@keyframes marquee {
		from {
			transform: translateX(0);
		}

		to {
			transform: translateX(-100%);
		}
	}
</style>